CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(scotch C)

FILE(GLOB CFILES ${CMAKE_SOURCE_DIR}/src/libscotch/*.c)
LIST(REMOVE_ITEM CFILES ${CMAKE_SOURCE_DIR}/src/libscotch/bgraph_bipart_df_loop.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/bdgraph.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/bdgraph_bipart_bd.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/bdgraph_bipart_df.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/bdgraph_bipart_df_loop.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/bdgraph_bipart_ex.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/bdgraph_bipart_ml.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/bdgraph_bipart_sq.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/bdgraph_bipart_st.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/bdgraph_bipart_zr.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/bdgraph_check.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/bdgraph_gather_all.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/bdgraph_store.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/comm.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/common_sort.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_allreduce.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_band.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_band_grow.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_build.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_build_grid3d.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_build_hcub.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_check.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_coarsen.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_fold.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_fold_comm.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_fold_dup.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_gather.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_gather_all.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_ghst.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_halo.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_halo_fill.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_io_load.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_io_save.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_induce.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_match.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_match_check.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_match_scan.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_match_sync_coll.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_match_sync_ptop.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_redist.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_scatter.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dgraph_view.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dmapping.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dmapping_io.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dorder.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dorder_gather.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dorder_io.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dorder_io_block.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dorder_io_tree.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dorder_perm.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/dorder_tree_dist.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/graph_coarsen.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/graph_coarsen_edge.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/graph_match_scan.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/hdgraph.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/hdgraph_check.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/hdgraph_fold.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/hdgraph_gather.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/hdgraph_order_io.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/hdgraph_order_nd.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/hdgraph_order_si.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/hdgraph_order_sq.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/hdgraph_order_st.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/hdgraph_induce.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/hgraph_induce.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/hgraph_induce_edge.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/kgraph_map_df_loop.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/kdgraph.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/kdgraph_gather.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/kdgraph_map_rb.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/kdgraph_map_rb_map.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/kdgraph_map_rb_part.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/kdgraph_map_st.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_band.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_band_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_band_grow.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_build.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_build_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_build_grid3d.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_build_grid3d_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_check.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_check_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_coarsen.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_coarsen_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_gather.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_gather_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_grow.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_halo.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_halo_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_induce.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_induce_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_io_load.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_io_load_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_io_save.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_io_save_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_io_stat_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_io_map_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_map.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_map_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_map_view.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_map_view_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_stat_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_order.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_order_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_order_gather.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_order_gather_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_order_io.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_order_io_block.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_order_io_block_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_order_io_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_order_perm.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_order_perm_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_order_tree_dist.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_order_tree_dist_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_redist.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_redist_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_scatter.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_scatter_f.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dgraph_stat.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dmapping.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_dorder.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/library_error.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/vdgraph.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/vdgraph_check.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/vdgraph_gather_all.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/vdgraph_separate_bd.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/vdgraph_separate_df.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/vdgraph_separate_ml.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/vdgraph_separate_sq.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/vdgraph_separate_st.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/vdgraph_separate_zr.c
                        ${CMAKE_SOURCE_DIR}/src/libscotch/vdgraph_store.c)

ADD_LIBRARY(scotch ${CFILES})
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/libscotch)

ADD_LIBRARY(scotcherr ${CMAKE_SOURCE_DIR}/src/libscotch/library_error.c)
